package com.blockchainenergy.info.user;

import com.blockchainenergy.info.user.dao.UserReleaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Data
public class UserReleaseVO {
    private String release_id;
    private Double total_elec;
    private Integer start_time;
    private Integer end_time;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date release_time;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date date;
    private String trade_type;
    private String trade_state_name;
    private Double price;

    public UserReleaseVO(UserReleaseEntity entity) {
        this.release_id = entity.getRelease_id();
        this.total_elec = entity.getTotal_elec();
        this.start_time = entity.getStart_time();
        this.end_time = entity.getEnd_time();
        this.release_time = entity.getRelease_time();
        this.date = entity.getDate();
        this.trade_type = entity.getTrade_type() ? "卖" : "买";
        this.trade_state_name = entity.getTrade_state_name();
        this.price = entity.getPrice();
    }
}
